package com.encryption.service;

import com.encryption.EncryptionService;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 *
 */
public class Md5Service extends EncryptionService {

  @Override
  public String encryption(String param, String key) {
    MessageDigest md5 = null;
    try {
      md5 = MessageDigest.getInstance(key);
    } catch (NoSuchAlgorithmException e) {
      e.printStackTrace();
    }
    md5.update(param.getBytes());

    return new String(md5.digest());
  }
}
